<?php
/**
 * Author: 1971229701@qq.com
 * Date: 2020/12/14/014
 * Time: 13:31
 */

namespace app\move\controller;


use app\common\model\Appoint as model;
use app\common\model\Cate;
use app\move\logic\VideoLogic;
use think\Request;

class Appoint extends Base
{
    public function index($cate_id = null,$zuixin = null,$zuiduo = null,$haoche = null)
    {
        $cate = Cate::all();
        $plan_time = get_arr(model::$plan_time);
        $r = (new VideoLogic())->video_square($cate_id,$zuixin,$zuiduo,$haoche);
        $this->assign('cate_list',$r['cate_list']);
        $this->assign('video_list',$r['video_list']);
        $this->assign('right_video',$r['right_video']);
        $this->assign('video_count',$r['video_count']);
        $this->assign('web_title','视频广场');
        $this->assign('plan_time', $plan_time);
        $this->assign('web_title', '预约试驾');
        $this->assign('cate', $cate);
        $this->assign('cat_id',$cate_id);
        $this->assign('zuixin',$zuixin);
        $this->assign('zuiduo',$zuiduo);
        $this->assign('haoche',$haoche);
        return $this->fetch();
    }

    public function create(Request $request)
    {
        $post = $request->post();
        if (isset($post['cid'])){
            $post['cid'] = implode(',',$post['cid']);
        }
        model::create($post);
        $this->success('添加成功','appoint/index','','1');
    }
}